package com.wyh.spring.demo.mapper;

import com.wyh.spring.demo.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.Mapping;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 王圆豪
 * Date: 2025-07-11
 * Time: 20:33
 */
@Mapper
public interface MessageInfoMapper {
    //插入数据到数据库
    @Insert("INSERT INTO message_info (`from`, `to`, message) VALUES (#{from},#{to},#{message})")
    Integer insertMessage(MessageInfo messageInfo);

    //从数据库中读取数据
    @Select("SELECT `FROM`,`TO`,message FROM message_info ORDER BY id ASC;")
    List<MessageInfo> selectAll();

}
